﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //Solution solution = new Solution();
            //Console.Write("请输入数组的长度：");
            //int Length = Convert.ToInt32(Console.ReadLine());
            ////ArrayList list = new ArrayList();
            ////List<int> list = new List<int>();
            //int[] list = new int[Length];
            //for (int i = 0; i < Length; i++)
            //{
            //    Console.Write("请输入第{0}个数组的值：", i + 1);
            //    list[i] = (Convert.ToInt32(Console.ReadLine()));
            //}
            //Array.Sort(list);
            //int length = solution.RemoveDuplicates(list);
            //Console.Write("长度为" + length);
            //Console.Read();
            //Solution2 solution2 = new Solution2();
            //int[] nums = {2,3,4,5,6,7 };
            //int k = 8;
            //solution2.Rotate(nums,k);
            //Console.Read();
            //string s = "hello";
            //char[] s1 = {'h','e','l','l','o' };
            //Solution4 solution4 = new Solution4();
            //solution4.ReverseString(s);
            //int x = 1534236469;
            //solution5 solution5 = new solution5();
            //solution5.Reverse(x);
            //Sulution6 solution6 = new Sulution6();
            //solution6.FirstUniqChar("loveleetcode");
            //Console.Write(solution6.FirstUniqChar("aadadaad"));
            //Console.ReadKey();

            //string filename ="wode.doc.doc";
            //int f = filename.LastIndexOf(".") + 1;
            //String fileName = filename.Substring(filename.LastIndexOf(".") + 1);
            //Console.Write(filename.Substring(0, filename.LastIndexOf(".")));
            //string test = "2019-03-06 10:26&xiongying&熊英&省中心库&一级库串码导入（直接到市一级库的物料）@2019-03-06 14:53&chenjianbo&陈建波&石家庄一级库&一级库确认入库@2019-03-22 09:42&chenhuixia&chenhuixia&行唐&二级库扫码入库@2019-03-22 16:20&yuanguanying&yuanguanying&行唐&待三级库入库确认@2019-03-22 17:01&188446320&188446320&代理-行唐县南桥超凡专营店&三级库入库确认@";
            //string[] name = test.TrimEnd('@').Split('@');
            //for (int i = 0; i < name.Length; i++)
            //{
            //    string[] na = name[i].Split('&');
            //    for (int j = 0; j < na.Length; j++)
            //    {
            //        Console.Write(na[j]);
            //    }
            //}

            //Solution9.MyAtoi("42");
            //Solution10 solution10 = new Solution10();
            //solution10.StrStr("aaaaa","bba");
            //Console.Write(solution10.StrStr("hello", "ll"));
            //Console.Read();
            //var str = "石家庄一级库";
            //var Str = str.Substring(0, str.IndexOf("一"));
            //Console.Write(Str);
            //Console.ReadLine();
            //Solution11 solution11 = new Solution11();
            //string[] strs = {"hello","helou","helllou" };

            //Console.Write(solution11.LongestCommonPrefix(strs));
            //Console.ReadLine();
            //Solution15 solution15 = new Solution15();
            //int[] nums = { 5, 7, 7, 8, 8, 10 };

            //Console.Write(solution15.SearchRange(nums, 8));
            //Console.Read();
            //;
            //Console.Write(Solution20.GenerateMatrix(3));
            //Console.Read();
            //Solution26 solution26 = new Solution26();
            //int[] nums = {1,2,3};
            //solution26.Subsets(nums);
            SMTP.SendCheckCodeToEmail();
        }
    }
    public class Solution
    {
        public int RemoveDuplicates(int[] nums)
        {
            if (nums == null || nums.Length == 0)
            {
                return 0;
            }
            else if (nums.Length == 1)
            {
                return 1;
            }
            else
            {
                int temp = nums[0];
                int len = 1;
                for (int i = 1; i < nums.Length; i++)
                {
                    if (temp == nums[i])
                    {
                        continue;
                    }
                    else
                    {
                        temp = nums[i];
                        nums[len] = nums[i];
                        len++;
                    }
                }
                return len;
            }
        }
    }
}